package com.moon.bigevent.service.impl;

import com.moon.bigevent.mapper.UserMapper;
import com.moon.bigevent.pojo.User;
import com.moon.bigevent.service.UserService;
import com.moon.bigevent.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper usermapper;
    @Override
    public User FindByUsername(String username) {

        User u = usermapper.FindByUsername(username);
        return u;
    }

    @Override
    public void Register(String username, String password) {
        String md5String = Md5Util.getMD5String(password);
        usermapper.add(username,md5String);
    }

    @Override
    public int DeleteByUsername(String username) {

        return usermapper.DeleteByUsername(username);
    }

    @Override
    public void update(User user) {
        usermapper.update(user);
    }
}
